package com.example.smartcitymovie.ui.movie;

import android.content.Intent;
import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.Toast;

import com.example.smartcitymovie.R;
import com.example.smartcitymovie.adapter.RecycleViewAdapter;
import com.example.smartcitymovie.bean.TheaterTimesListBean;
import com.example.smartcitymovie.databinding.FragmentMovieTimesBinding;

import java.util.List;


public class MovieTimesFragment extends Fragment {


    List<TheaterTimesListBean.RowsBean> beanList;
    FragmentMovieTimesBinding binding;

    public MovieTimesFragment(List<TheaterTimesListBean.RowsBean> beanList) {
        // Required empty public constructor
        this.beanList = beanList;
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        binding = FragmentMovieTimesBinding.inflate(inflater);
        initView();
        return binding.getRoot();
    }

    private void initView() {
        binding.RVShowTimesList.setLinearLayoutManager(LinearLayout.VERTICAL);
        binding.RVShowTimesList.setAdapter(beanList, R.layout.theater_movie_times_list_item_layout);
        binding.RVShowTimesList.getBaseAdapter().setOnPartRecycleViewItemClickListener(new RecycleViewAdapter.OnPartRecycleViewItemClickListener() {
            @Override
            public void onPartRecycleViewItemClickListener(View view, int position) {
                Toast.makeText(getActivity(),"购票成功",Toast.LENGTH_SHORT).show();
            }
        }, R.id.btn_buyTicketsFour);
    }
}